<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Bluebird</title>
</head>
<body>

  <script src="https://cdn.bootcss.com/bluebird/3.5.1/bluebird.min.js"></script>
  <script>
    function loadImg(src) {
      return new Promise((resolve,reject) => {
        const img = new Image();
        img.onload = ()=>{
          resolve(img);
        }
        img.onerror = () => {
          reject()
        }
        img.src = src;
      })
    }
    const result = loadImg('http://file.ituring.com.cn/SmallCover/17114893a523520c7382');
    result.then(img => {
      console.log(img.width)
    },() => {
      console.log('fail')
    });
    console.log(Promise === P)  // true
  </script>
</body>
</html>